<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Api_Model_Notification
{
	private $notifcation_id;
	private $type;
	private $status;
	private $user_id;
	private $concern_id;
	private $updated_time;

	public function __construct($notification_row = null) {
		if(!is_null($notification_row) && $notification_row instanceof Zend_Db_Table_Row) {
			$this->notifcation_id = $notification_row->notifcation_id;
			$this->type = $notification_row->type;
			$this->status = $notification_row->status;
			$this->user_id = $notification_row->user_id;
			$this->concern_id = $notification_row->concern_id;
			$this->updated_time = $notification_row->updated_time;
		}
	}

	public function __set($name, $value) {
		switch($name) {
			case 'notifcation_id':
				if(!is_null($this->notifcation_id)) {
					throw new Exception('Cannot update notification\'s id');
				}
				break;
			case 'type':
				if(!is_null($this->type)) {
					throw new Exception('Cannot update type');
				}
				break;
			case 'status':
				if(!is_null($this->status)) {
					throw new Exception('Cannot update status');
				}
				break;
			case 'user_id':
				if(!is_null($this->user_id)) {
					throw new Exception('Cannot update user id');
				}
				break;
			case 'concern_id':
				if(!is_null($this->concern_id)) {
					throw new Exception('Cannot update concern id');
				}
				break;
			case 'updated_time':
				if(!is_null($this->updated_time)) {
					throw new Exception('Cannot update updated_time');
				}
				break;
		}
		$this->$name = $value;
	}

	public function __get($name) {
		return $this->$name;
	}
}